function addCommas(nStr) {
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    }
    return x1 + x2;
}

$Behavior.marketplaceAdd = function()
{
	$('.js_mp_category_list').change(function()
	{
		var iParentId = parseInt(this.id.replace('js_mp_id_', ''));
		
		$('.js_mp_category_list').each(function()
		{
			if (parseInt(this.id.replace('js_mp_id_', '')) > iParentId)
			{
				$('#js_mp_holder_' + this.id.replace('js_mp_id_', '')).hide();				
				
				this.value = '';
			}
		});
		
		$('#js_mp_holder_' + $(this).val()).show();
	});	
	
	$('#price').keyup(function()
	{
		if($('#price').val()!='0.00'){
			$('#price_show').html(addCommas($('#price').val()));
		}	
	});	
	
	
}

$Behavior.onLoadEvents = function(){
	if($('#price').val()=='0.00'){
		$('#price').val('');
	}	
	$( ".page_section_menu ul li a" ).each(function( index ) {
	 	if($(this).attr('rel') == 'js_mp_block_invite'){
			$(this).css('display','none');
		}
	});
}